import json
dic ={
    'name':"QQ",
    'age':"18",
}
#w直接写会覆盖，a在后面拼接
with open("C:/Users/Administrator/PycharmProjects/xxq/data.txt",'a') as f:
    json_str = json.dumps(dic)
    f.write(json_str)
    #f.write(dic)
    print("成功写入")
    pass